Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(swagger): fix resolved swagger ui asset path for ESM version #2684

Merged
merged 1 commit into from
Apr 27, 2024

Conversation

Romakita
Copy link
Collaborator

@Romakita Romakita commented Apr 27, 2024

Closes: #2683

Information

Type Breaking change
Fix No

fix the swagger ui asset path resolved for ESM version

Summary by CodeRabbit

  • Refactor
    • Improved the integration of Swagger UI by refining the path configuration, enhancing the accessibility and reliability of API documentation.

Copy link

coderabbitai bot commented Apr 27, 2024

Walkthrough

The change involves modifying the SWAGGER_UI_DIST constant in the constants.js file to ensure the proper loading of Swagger UI assets by removing the "file://" prefix from the resolved path. This adjustment aims to address issues with asset loading that resulted in 404 errors.

Changes

File Path Change Summary
packages/.../swagger/scripts/constants.js Modified SWAGGER_UI_DIST to strip "file://" from the resolved path.

Assessment against linked issues

Objective Addressed Explanation
Swagger UI no longer loads [#2683]

Poem

🐰 Oh hoppity day, a fix is here! 🌟
No more 404s, let's give a cheer!
The paths are clean, the files in sight,
Swagger UI loads, oh what a delight!
🎉📂🔧


Recent Review Details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits Files that changed from the base of the PR and between 501f4dd and 88a8f7d.
Files selected for processing (1)
  • packages/specs/swagger/scripts/constants.js (1 hunks)
Files skipped from review due to trivial changes (1)
  • packages/specs/swagger/scripts/constants.js

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share
Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (invoked as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger a review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@Romakita Romakita merged commit a507869 into production Apr 27, 2024
15 checks passed
@Romakita Romakita deleted the fix-2683-esm-load-swagger-assets branch April 27, 2024 16:47
Copy link

Benchmarks

  • Machine: linux x64 | 4 vCPUs | 15.6GB Mem
  • Node: v18.20.2
  • Run: Sat Apr 27 2024 16:53:05 GMT+0000 (Coordinated Universal Time)
  • Method: autocannon -c 100 -d 10 -p 10 localhost:3000 (two rounds; one to warm-up, one to measure)
Version Router Requests/s Latency Throughput/Mb
koa 2.13.4 35357.6 27.76 6.31
tsed-koa 7.68.2 12592.4 78.65 10.66
express 4.19.2 11067.8 89.52 1.97
nest 8.4.3 10366.9 95.64 2.49
express-injector 4.19.2 9963.8 99.35 2.27
tsed-express 7.68.2 9208.2 107.62 1.69
express-morgan 4.19.2 5918.0 167.31 1.06
fastify-big-json 3.29.4 N/A N/A N/A
fastify-injector 3.29.4 N/A N/A N/A
fastify 3.29.4 N/A N/A N/A
nest-fastify 8.4.3 N/A N/A N/A

Explanation

The benchmark shows a performance difference between the frameworks. We note that Ts.ED is often last. In fact, Ts.ED uses features useful to a production application which reduce its performance.

For example, Ts.ED initializes a sandbox (async_hook) for each request in order to work in an isolated context if necessary.
It also initializes the elements necessary for monitoring requests in a log manager.

All this at a necessary cost that reflects the reality of a production application ;)

@Romakita
Copy link
Collaborator Author

🎉 This PR is included in version 7.68.3 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[BUG] Swagger UI no longer loads
2 participants